/**
 * @Author: luqimin
 * @Date:   2017-11-20 16:66:66
 */

import React, {Component} from 'react';
import styles from './index.less';
import CSSModules from 'react-css-modules';
import {Route, Link} from 'react-router-dom';
import PageHeader from 'ant-design-pro/lib/PageHeader';
import DescriptionList from 'ant-design-pro/lib/DescriptionList';
import {Button, Icon, Dropdown, Avatar, Tag, Row, Col} from 'antd';

const {Description} = DescriptionList;
const ButtonGroup = Button.Group;

import BrandList from './BrandList';
import ModelList from './ModelList';
import CarConfig from './carConfig';
import ArticleList from './articleList';

class Home extends Component {
  constructor(props) {
    super(props);
    this.state = {
      userId: '',
      workOrderId: '',
    };
  }

  componentDidMount() {}
  componentWillReceiveProps(nextProps) {}

  getHeaderMsg() {
    let title, action, description, breadcrumbList, Link;
    title = '品牌';
    action = (
      <div>
        <Button type="primary">
          <Icon type="plus" />新增型号
        </Button>
      </div>
    );
    breadcrumbList = [
      {
        title: '车库',
        href: '/vehicle',
      },
      {
        title: '品牌列表',
      },
    ];
    return {title, action, description, breadcrumbList};
  }

  getPageHeader() {
    const {
      title,
      breadcrumbList,
      action,
      description,
      tabList,
    } = this.getHeaderMsg();

    return (
      <PageHeader
        title={title}
        action={action}
        content={description}
        breadcrumbList={breadcrumbList}
        linkElement={Link}
        className={styles.pageHeader}
      />
    );
  }
  render() {
    const {match} = this.props;
    return (
      <div className={styles['home-wrap']}>
        <Route path={`${match.path}`} exact component={BrandList} />
        <Route
          exact
          path={`${match.path}/model/:modelId`}
          component={ModelList}
        />
        <Route
          exact
          path={`${match.path}/model/:modelId/spec/:specId`}
          component={CarConfig}
        />
        <Route
          exact
          path={`${match.path}/brand/:brandId/article/:carId`}
          component={ArticleList}
        />
      </div>
    );
  }
}

export default CSSModules(Home, styles);
